<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>订单评论</title>
    <!-- Path to Framework7 Library CSS-->
    <link rel="stylesheet" href="../css/framework7.ios.min.css">
    <link rel="stylesheet" href="../css/framework7.ios.colors.min.css">
    <!-- Path to your custom app styles-->
    <link rel="stylesheet" href="../css/my-app.css">
    <link rel="stylesheet" href="../css/ekang.css"/>
    <style type="text/css">
        .score-back {
            position: relative;
            width: 100%;
            height: 75px;
            border-bottom: 1px solid #e6e6e6;
        }
        .score-title {
            position: absolute;
            font-size: 12px;
            color: #999999;
            left: 10px;
            top: 15px;
        }
        .score-img {
            width: 20px;
            height: 20px;
            margin-top: 14px;
        }
        .score-img-up {
            width: 20px;
            height: 20px;
            margin-top: 5px;
        }
        .score {
            display: none;
        }

        .content-center {
            position: relative;
            width: 100%;
            height: 44px;
            border-bottom: 1px solid #e6e6e6;
        }
        .content-center input {
            position: absolute;
            width: 94%;
            height: 42px;
            font-size: 12px;
            color: #999999;
            left: 10px;
            border: none;
        }

        .content-bottom {
            position: relative;
            width: 100%;
            height: 140px;
            margin-top: 15px;
            border-bottom: 1px solid #e6e6e6;
            border-top: 1px solid #e6e6e6;
        }

        .content-bottom textarea {
            position: absolute;
            width: 94%;
            height: 110px;
            left: 10px;
            top: 15px;
            font-size: 12px;
            color: #999999;
            border: none;
        }

        .submit {
            position: relative;
            margin-top: 15px;
            width: 100%;
            height: 44px;
            background-color: #43af80;
            color: #fff;
            font-size: 16px;
            border: none;
        }

    </style>
</head>
<body>

<div class="views tabs toolbar-through">
    <!--导航条-->
    <!-- Second view (for second wrap)-->
    <div id="view" class="view view-main tab active">
        <!-- We can make with view with navigation, let's add Top Navbar-->
        <div class="navbar">
            <div class="navbar-inner" style="background-color: #38a16d">
                <div class="left" id="back">
                    <a href="#" class="back link">
                        <i class="icon icon-back color-white" style="color: white"></i>
                        <span style="color: white">返回</span>
                    </a>
                </div>
                <div class="center sliding" style="color: white">我要评价</div>
            </div>
        </div>

        <div class="pages navbar-through">
            <div data-page="index-2" class="page page-on-center">
                <div class="page-content" style="background-color: white">
                    <div class="score-back">
                        <div class="evaluate1">
                            <span class="score-title">就诊态度打分</span>
                            <img src="../img/mypage_img/icon_star.png" class="score-img inline-block" style="margin-left: 110px;"/>
                            <img src="../img/mypage_img/icon_star.png" class="score-img inline-block"/>
                            <img src="../img/mypage_img/icon_star.png" class="score-img inline-block"/>
                            <img src="../img/mypage_img/icon_star.png" class="score-img inline-block"/>
                            <img src="../img/mypage_img/icon_star.png" class="score-img inline-block"/>
                            <span class="score" id="score1" style="background-color: #00d449"></span>
                        </div>
                        <div class="evaluate2">
                            <span class="score-title" style="top: 45px;">就诊疗效打分</span>
                            <img src="../img/mypage_img/icon_star.png" class="score-img-up inline-block" style="margin-left: 110px;"/>
                            <img src="../img/mypage_img/icon_star.png" class="score-img-up inline-block"/>
                            <img src="../img/mypage_img/icon_star.png" class="score-img-up inline-block"/>
                            <img src="../img/mypage_img/icon_star.png" class="score-img-up inline-block"/>
                            <img src="../img/mypage_img/icon_star.png" class="score-img-up inline-block"/>
                            <span class="score" id="score2" style="background: #007aff;"></span>
                        </div>
                    </div>
                    <div class="content-center">
                        <input id="disease" type="text" placeholder="您就诊的疾病"/>
                    </div>
                    <div class="content-bottom">
                        <textarea id="content_text" placeholder="对医生想要说的话" ></textarea>
                    </div>

                    <input type="button" value="匿名提交" class="submit"/>
                </div>
            </div>
        </div>
    </div>

</div>
<script type="text/javascript" src="../js/framework7.min.js"></script>
<script type="text/javascript" src="../js/my-app.js"></script>
<script src="../js/jquery-1.10.2.js"></script>
<script src="../js/ekang.js"></script>
<script src="../js/jquery.cookie.js"></script>
<script>

    $(function () {
        var doctorid = getQueryString("doctor_id");
        var attitude;
        var effect;
        var app = {
            submit: function () {
                $.ajax({
                    type: 'GET',
                    url: textUrl + '/diagnosis/submitOrder/',
                    data: {         // 需要于客户端同步
                        uid : $.cookie("local_userId"),
                        doctor_id : doctorid,
                        attitude : attitude,
                        effect : effect,
                        disease : $('#disease').val(),
                        review_content : $('#content_text').val()
                    },
                    dataType: 'jsonp',
                    jsonp: 'callback',
                    success: function (result) {
                        if (result.ret == 0) {
                            history.go(-1);
                        } else {
                            alert(result.msg);
                        }
                    }
                });
            },
        };

        $('.submit').click(function () {
            if(!$('#disease').val()){
                alert("您就诊的疾病");
                return;
            }
            if(!$('#content_text').val()){
                alert("您就诊的疾病");
                return;
            }
            app.submit();
        });

        $('#back').click(function () {
            history.back();
        });

        $(".evaluate1 img").click(function() {
            $(".evaluate1 img").attr("src", "../img/mypage_img/icon_star.png").prevAll().attr("src", "../img/mypage_img/icon_star.png");
            $("#score1").html(parseInt($(this).index(".evaluate1 img")) + 1);
            attitude = parseInt($(this).index(".evaluate1 img")) + 1;
            $(this).attr("src", "../img/mypage_img/icon_redstar.png").prevAll().attr("src", "../img/mypage_img/icon_redstar.png");
        });
        $(".evaluate2 img").click(function() {
            $(".evaluate2 img").attr("src", "../img/mypage_img/icon_star.png").prevAll().attr("src", "../img/mypage_img/icon_star.png");
            $("#score2").html(parseInt($(this).index(".evaluate2 img")) + 1);
            effect = parseInt($(this).index(".evaluate2 img")) + 1;
            $(this).attr("src", "../img/mypage_img/icon_redstar.png").prevAll().attr("src", "../img/mypage_img/icon_redstar.png");
        });
    });

//    var clientType=-1;
//    var orderId = -1;
//    $(document).ready(function(){
//        clientType = getQueryString("type");
//        orderId = getQueryString("id");
//
//        customAlertInit();
//
//        hideGetMore();
//
//        if(clientType==2){
//            connectWebViewJavascriptBridge(function(bridge) {
//                bridge.init(function(message, responseCallback) {
//
//                });
//
//            });
//        }
//
//    });


//    $(function() {
//
//        $(".evaluate1 img").mousedown(function() {
//            $(".evaluate1 img").attr("src", "/resources/img/shopMain/xing_gray.png").prevAll().attr("src", "/resources/img/shopMain/xing_gray.png");
//            $("#score1").html(parseInt($(this).index(".evaluate1 img")) + 1);
//            $(this).attr("src", "/resources/img/shopMain/xing_full.png").prevAll().attr("src", "/resources/img/shopMain/xing_full.png");
//        });
//        $(".evaluate2 img").mousedown(function() {
//            $(".evaluate2 img").attr("src", "/resources/img/shopMain/xing_gray.png").prevAll().attr("src", "/resources/img/shopMain/xing_gray.png");
//            $("#score2").html(parseInt($(this).index(".evaluate2 img")) + 1);
//            $(this).attr("src", "/resources/img/shopMain/xing_full.png").prevAll().attr("src", "/resources/img/shopMain/xing_full.png");
//        });
//    })
//
//    function post(){
//
//        $.ajax({
//            type: "post",
//            dataType: "json",
//            timeout : 5000,
//            cache:false,
//            url:base_path + base_version + "/order/createComm.json",
//            data: formData,
//            contentType: 'application/json;charset=utf-8',
//            complete :function(msg){
//
//                var dataObj = eval("("+msg.responseText+")");
//                if(dataObj.resultCode == success_code){
//                    showMsg("感谢您的评价");
//                    history.back();
//                }else{
//
//                    showMsg(dataObj.resultMsg);
//                }
//            },
//            error : function() {
//                // view("异常！");
//                showMsg("远程服务器异常，请稍后再试");
//            },
//            async:true
//        });
//    }

</script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript"></script>
<script src="../js/weixin2.js"></script>
</body>
</html>